<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org"
      xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity3" xmlns:head="http://www.w3.org/1999/html">
<head th:include="public/public_css::public_css ('用户管理')" />

<body style="background-color: #f2f2f2;">
<div class="layui-fluid larry-wrapper">
    <div class="layui-card">
        <div class="layui-row layui-col-space30">
        <div class="layui-col-xs24">
                <form class="layui-form layui-card-header  layui-card-header-auto" id="searchForm">
                    <div class="layui-inline">
                        <label class="layui-form-label">记录时间</label>
                        <div class="layui-input-inline">
                            <input type="text" class="layui-input" name="jlsj" id="test5" placeholder="yyyy-MM-dd HH:mm:ss" />
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">错误级别</label>
                            <select name="jb" lay-filter="aihao">
                                <option value=""></option>
                                <option value="0">全部</option>
                                <option value="1" selected="">调试</option>
                                <option value="2">信息</option>
                                <option value="3">警告</option>
                                <option value="4">错误</option>
                            </select>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">记录时间</label>
                        <div class="layui-input-inline">
                            <input type="text" class="layui-input" id="test2" placeholder="yyyy-MM-dd HH:mm:ss" />
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">select2选择测试</label>
                        <div class="layui-input-inline">
                            <select lay-ignore="lay-ignore" class="js-data-example-ajax" name="select2cs" style="width: 193px"></select>
                        </div>
                    </div>
                    <div class="layui-inline inline-search-btn">
                        <a class="layui-btn layui-btn-normal" data-type="reload">搜索</a>
                    </div>
                    <div class="moreSearch" style="display: none">
                        <div class="layui-inline">
                            <label class="layui-form-label">记录时间</label>
                            <div class="layui-input-inline">
                                <input type="text" class="layui-input" name="jlsj2" id="test1" placeholder="yyyy-MM-dd HH:mm:ss" />
                            </div>
                        </div>
                        <div class="layui-inline">
                            <label class="layui-form-label">错误级别</label>
                            <select name="jb2" lay-filter="aihao">
                                <option value=""></option>
                                <option value="0">全部</option>
                                <option value="1" selected="">调试</option>
                                <option value="2">信息</option>
                                <option value="3">警告</option>
                                <option value="4">错误</option>
                            </select>
                        </div>
                        <div class="layui-inline">
                            <label class="layui-form-label">记录时间</label>
                            <div class="layui-input-inline">
                                <input type="text" class="layui-input" id="test3" placeholder="yyyy-MM-dd HH:mm:ss" />
                            </div>
                        </div>
                        <div class="layui-inline">
                            <label class="layui-form-label">select2选择测试</label>
                            <div class="layui-input-inline">
                                <select lay-ignore="lay-ignore" class="js-data-example-ajax" name="select2cs" style="width: 193px"></select>
                            </div>
                        </div>
                    </div>
                </form>
            <div class="moreBtn"><i class="layui-icon layui-icon-triangle-d" style="color: #1E9FFF;"></i></div>
            <div class="group-button" id="toolbar">
                <a class="layui-btn layui-btn-sm layui-btn-danger">
                    <i class="iconfont">&#xe626;</i> 删除
                </a>
                <a class="layui-btn layui-btn-sm layui-btn-normal add-btn">
                    <i class="layui-icon">&#x1005;</i> 添加
                </a>
                <a class="layui-btn layui-btn-sm layui-btn-normal edit-btn">
                    <i class="layui-icon">&#x1005;</i> 修改
                </a>
                <!-- Single button -->
                <div class="btn-group">
                    <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                        多选操作 <span class="caret"></span>
                    </button>
                    <ul class="dropdown-menu">
                        <li><a href="#">多选删除</a></li>
                        <li><a href="#">多选打印</a></li>
                        <li><a href="#">明细表</a></li>
                        <li role="separator" class="divider"></li>
                        <li><a href="#">Separated link</a></li>
                    </ul>
                </div>
            </div>
            <!--列表-->
            <section class="panel panel-padding layui-card-body" >
                <div class="pro">
                    <table id="table"></table>
                </div>
            </section>
        </div>
    </div>
    </div>
</div>

</body>


<div th:include="public/public_js::public_js"></div>
<style type="text/css">

</style>
<script>
    $(function () {

        $('.js-data-example-ajax').select2({
            ajax: {
                url: '/zxsswms/wmsgoodstype/getWmsGoodsTypeByHzId',
                dataType: 'json',
                type: 'POST',
                contentType: "application/json",
                data: function (params) {
                    var query = {
                        mc: params.term
                    };
                    return JSON.stringify(query);
                },
                processResults: function (data) {
                    var arr= new Array();
                    if(data){
                        for (var i=0;i<data.length;i++){
                            arr.push({id:data[i].id,text:data[i].mc});
                        }
                    }
                    console.log(arr);
                    // Tranforms the top-level key of the response object from 'items' to 'results'
                    return {
                        results: arr
                    };
                },
                cache: true
            },
            language: "zh-CN",
            placeholder: '请输入查询字段',
            allowClear: true
        });
        console.log("我来了！！ ");
        $(".moreBtn").on("click",function () {
            $(".moreSearch").toggle();
        })
    });


    layui.use(['list','layer','zzpUtils','jquery','laydate'],function () {
          window.operateEvent ={
              "click .layui-btn-primary":function (e, value, row, index) {
                  alert(row.mc);
              },
              "click #editRow":function (e, value, row, index) {
                  editDialog(row.id);
              }
          }

        var zzpUtils= layui.zzpUtils,
            $ = layui.jquery,
            laydate = layui.laydate;
        function editDialog(id){
            zzpUtils.dialog({
                title:"添加用户",
                type:2,
                data:{
                    id:id
                },
                content: "/sysuser/editUser"
            });
        }
        laydate.render({
            elem: '#test5'
            ,theme: '#20a0ff'
        })
        var $table = zzpUtils.table({
            elem: '#table',
            isApi: true,
            pagination:true,
            url: '/sysLog/list',
            columns: [{
                field: '',
                checkbox: true
            }, {
                field: 'jb',
                title: '错误级别'
            },{
                field: 'mk',
                title: '模块'
            },{
                field: 'an',
                title: '按钮'
            },{
                field: 'jlsj',
                title: '记录时间'
            },{
                field: 'xx',
                title: '信息'
            },{
                field: 'ycyy',
                title: '异常原因'
            },{
                field: 'clr',
                title: '处理人'
            },{
                field: 'clsj',
                title: '处理时间'
            },{
                field: 'cljg',
                title: '处理结果'
            },{
                field: 'clzt',
                title: '处理状态'
            },{
                field:'caozuo',
                title: '操作',
                events:operateEvent,
                formatter:operateFormatter
            }],
            queryParams: function () {//查询条件
                return  zzpUtils.getFormJson($("#searchForm"));
            },
            detailFormatter: function (index, row) {
                return "这里就没有确定过11";
            }

        });

       function operateFormatter(value, row, index) {
            return [
                '<a class="layui-btn layui-btn-primary layui-btn-xs" >查看</a>',
                '<a class="layui-btn layui-btn-xs" id="editRow">编辑</a>',
                '<a class="layui-btn layui-btn-danger layui-btn-xs">删除</a>'
            ].join('')
        }

        $(".inline-search-btn").on('click',function () {
            zzpUtils.refreshTable("#table");
        })
        $(".add-btn").on('click',function () {
            zzpUtils.dialog({
                title:"添加用户",
                type:2,
                content: "/sysuser/addUser"
            });
//            var index = top.layui.layer.open({
//                title : "添加用户",
//                type : 2,
//                content : "12312",
//                success : function(layero, index){
//
////                    var body = layui.layer.getChildFrame('body', index);
////                    if(edit){
////                        body.find(".userName").val(edit.userName);  //登录名
////                        body.find(".userEmail").val(edit.userEmail);  //邮箱
////                        body.find(".userSex input[value="+edit.userSex+"]").prop("checked","checked");  //性别
////                        body.find(".userGrade").val(edit.userGrade);  //会员等级
////                        body.find(".userStatus").val(edit.userStatus);    //用户状态
////                        body.find(".userDesc").text(edit.userDesc);    //用户简介
////                        form.render();
////                    }
////                    setTimeout(function(){
////                        layui.layer.tips('点击此处返回用户列表', '.layui-layer-setwin .layui-layer-close', {
////                            tips: 3
////                        });
////                    },500)
//                }
//            });

//            top.layui.layer.full(index);
//            //改变窗口大小时，重置弹窗的宽高，防止超出可视区域（如F12调出debug的操作）
//            $(window).on("resize",function(){
//                top.layui.layer.full(index);
//            })
        })

    });
</script>
</html>